package org.example.petitionplatformsystem.service.Impl;

import org.example.petitionplatformsystem.dao.AuthenticationRepository;
import org.example.petitionplatformsystem.dao.model.Authentication;
import org.example.petitionplatformsystem.service.AuthenticationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AuthenticationServiceImpl implements AuthenticationService {
    @Autowired
    private AuthenticationRepository authenticationRepository;
    @Override
    public Authentication AddAuthentication(Authentication authentication) {
        return authenticationRepository.save(authentication);
    }

    @Override
    public void DeleteAuthentication(long AuthenticationId) {
        authenticationRepository.deleteById(AuthenticationId);
    }

    @Override
    public Authentication UpdateAuthentication(Authentication d) {
        return authenticationRepository.save(d);
    }

    @Override
    public List<Authentication> GetAllAuthentication() {
        return authenticationRepository.findAll();
    }

    @Override
    public Authentication GetUsersByID(String IdCardNumber) {
        return null;
    }

    @Override
    public Authentication GetAuthenticationByUserId(long userId) {
        return authenticationRepository.findByUserId(userId);
    }


}
